package com.xc.service.Impl;

import com.xc.dao.RoomMapper;
import com.xc.pojo.Room;
import com.xc.service.RoomService;
import com.xc.vo.RoomVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class RoomServiceImpl implements RoomService {
    @Resource
    private RoomMapper roomMapper;

    /**
     * 查询房间列表
     * @param roomVo
     * @return
     */
    public List<Room> queryRoomList(RoomVo roomVo) {
        return roomMapper.queryRoomList(roomVo);
    }

    /**
     * 添加房间
     * @param room
     * @return
     */
    public int addRoom(Room room) {
        return roomMapper.addRoom(room);
    }
    /**
     * 修改房间
     * @param room
     * @return
     */
    public int updateRoom(Room room) {
        return roomMapper.updateRoom(room);
    }
    /**
     * 删除房间
     * @param id
     * @return
     */
    public int deleteRoom(Integer id) {
        return roomMapper.deleteById(id);
    }

    public Room findById(Integer id) {
        return roomMapper.findById(id);
    }
}
